package cc.wangzijie.ddns.aliyun.demo;

import cc.wangzijie.ddns.aliyun.client.utils.AccessKey;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.Gson;
import java.util.*;
import com.aliyuncs.alidns.model.v20150109.*;

public class UpdateDomainRecord {

    public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile("cn-qingdao", AccessKey.ID, AccessKey.SECRET);
        IAcsClient client = new DefaultAcsClient(profile);

        UpdateDomainRecordRequest request = new UpdateDomainRecordRequest();
        request.setRecordId("21126757727888384");
        request.setRR("@");
        request.setType("A");
        request.setValue("9.9.9.9");

        try {
            UpdateDomainRecordResponse response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            System.out.println("ErrCode:" + e.getErrCode());
            System.out.println("ErrMsg:" + e.getErrMsg());
            System.out.println("RequestId:" + e.getRequestId());
        }

    }
}
